<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:a="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/template.xhtml">

<ui:define name="body">

    <h:form id="studentCertificateLocation" styleClass="edit">

        <rich:panel>
            <f:facet name="header">#{studentCertificateLocationHome.managed ? 'Edit' : 'Add'} Student certificate location</f:facet>


            <s:decorate id="idField" template="layout/edit.xhtml">
                <ui:define name="label">Id</ui:define>
                <h:inputText id="id"
                       required="true"
                       disabled="#{studentCertificateLocationHome.managed}"
                          value="#{studentCertificateLocationHome.instance.id}">
                    <a:support event="onblur" reRender="idField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>




            <s:decorate id="locationUrlField" template="layout/edit.xhtml">
                <ui:define name="label">Location url</ui:define>
                <h:inputText id="locationUrl"
                           size="100"
                      maxlength="150"
                          value="#{studentCertificateLocationHome.instance.locationUrl}">
                    <a:support event="onblur" reRender="locationUrlField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>

            <div style="clear:both">
                <span class="required">*</span>
                required fields
            </div>

        </rich:panel>

        <div class="actionButtons">

            <h:commandButton id="save"
                          value="Save"
                         action="#{studentCertificateLocationHome.persist}"
                       disabled="#{!studentCertificateLocationHome.wired}"
                       rendered="#{!studentCertificateLocationHome.managed}"/>

            <h:commandButton id="update"
                          value="Save"
                         action="#{studentCertificateLocationHome.update}"
                       rendered="#{studentCertificateLocationHome.managed}"/>

            <h:commandButton id="delete"
                          value="Delete"
                         action="#{studentCertificateLocationHome.remove}"
                      immediate="true"
                       rendered="#{studentCertificateLocationHome.managed}"/>

            <s:button id="cancelEdit"
                   value="Cancel"
             propagation="end"
                    view="/StudentCertificateLocation.xhtml"
                rendered="#{studentCertificateLocationHome.managed}"/>

            <s:button id="cancelAdd"
                   value="Cancel"
             propagation="end"
                    view="/#{empty studentCertificateLocationFrom ? 'StudentCertificateLocationList' : studentCertificateLocationFrom}.xhtml"
                rendered="#{!studentCertificateLocationHome.managed}"/>

        </div>
    </h:form>

<rich:tabPanel switchType="ajax">

    <rich:tab label="Student">
    <div class="association" id="studentParent">

        <h:outputText value="There is no student associated with this studentCertificateLocation."
                   rendered="#{studentCertificateLocationHome.instance.student == null}"/>

        <rich:dataTable var="_student"
                   value="#{studentCertificateLocationHome.instance.student}"
                rendered="#{studentCertificateLocationHome.instance.student != null}"
              rowClasses="rvgRowOne,rvgRowTwo"
                      id="studentTable">
            <h:column>
                <f:facet name="header">Id</f:facet>
                <h:outputText value="#{_student.id}"/>
            </h:column>
            <h:column>
                <f:facet name="header">UserAccount id</f:facet>
                <h:outputText value="#{_student.userAccount.id}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Course id</f:facet>
                <h:outputText value="#{_student.course.id}"/>
            </h:column>
            <h:column>
                <f:facet name="header">First name</f:facet>
                <h:outputText value="#{_student.firstName}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Last name</f:facet>
                <h:outputText value="#{_student.lastName}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Passport photo url</f:facet>
                <h:outputText value="#{_student.passportPhotoUrl}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Date of birth</f:facet>
                <h:outputText value="#{_student.dateOfBirth}">
                    <s:convertDateTime type="date" dateStyle="short"/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Register number</f:facet>
                <h:outputText value="#{_student.registerNumber}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Roll number</f:facet>
                <h:outputText value="#{_student.rollNumber}"/>
            </h:column>
        </rich:dataTable>

        <div class="actionButtons">
            
            <s:button id="#{studentCertificateLocationHome.instance.student != null ? 'changeParentstudent' : 'selectParentstudent'}" value="#{studentCertificateLocationHome.instance.student != null ? 'Change' : 'Select'} student"
                       view="/StudentList.xhtml">
                       
                       
                <f:param name="from" value="StudentCertificateLocationEdit"/>
            </s:button>
        </div>

    </div>
    </rich:tab>

    <rich:tab label="Student cerficate">
    <div class="association" id="studentCerficateParent">

        <h:outputText value="There is no studentCerficate associated with this studentCertificateLocation."
                   rendered="#{studentCertificateLocationHome.instance.studentCerficate == null}"/>

        <rich:dataTable var="_studentCerficate"
                   value="#{studentCertificateLocationHome.instance.studentCerficate}"
                rendered="#{studentCertificateLocationHome.instance.studentCerficate != null}"
              rowClasses="rvgRowOne,rvgRowTwo"
                      id="studentCerficateTable">
            <h:column>
                <f:facet name="header">Id</f:facet>
                <h:outputText value="#{_studentCerficate.id}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Student id</f:facet>
                <h:outputText value="#{_studentCerficate.student.id}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Certificate id</f:facet>
                <h:outputText value="#{_studentCerficate.certificate.id}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Received status</f:facet>
                <h:outputText value="#{_studentCerficate.receivedStatus}"/>
            </h:column>
        </rich:dataTable>

        <div class="actionButtons">
            
            <s:button id="#{studentCertificateLocationHome.instance.studentCerficate != null ? 'changeParentstudentCerficate' : 'selectParentstudentCerficate'}" value="#{studentCertificateLocationHome.instance.studentCerficate != null ? 'Change' : 'Select'} studentCerficate"
                       view="/StudentCerficateList.xhtml">
                       
                       
                <f:param name="from" value="StudentCertificateLocationEdit"/>
            </s:button>
        </div>

    </div>
    </rich:tab>
</rich:tabPanel>
</ui:define>

</ui:composition>
